package com.longqin.wechat.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.longqin.wechat.entity.ResponseData;
import com.longqin.wechat.entity.WfFlow;
import com.longqin.wechat.entity.WfProcess;
import com.longqin.wechat.feign.FeignService;
import com.longqin.wechat.service.IWfWorkService;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author longqin
 * @since 2023-11-01
 */
@RestController
@RequestMapping("/wfWork")
public class WfWorkController {
	
	@Autowired
	IWfWorkService workService;
	
	@Autowired
	FeignService feignService;

	/**
	 * @Description 获取待办/已办工作清单
	 * @Author longqin
	 * @Time: 2025年05月12日
	 */
	@GetMapping("/getProcessList")
	public List<WfProcess> getProcessList(Integer status, String beginDate, String endDate) {
		return workService.getProcessList(status, beginDate, endDate);
	}
	
	/**
	 * @Description 获取工作所有表单
	 * @Author longqin
	 * @Time: 2025年05月16日
	 */
	@GetMapping("/getWorkFlowProcessList")
	public ResponseData<Object> getWorkFlowProcessList(Integer workId) {
		return feignService.getWorkFlowProcessList(workId);
	}
	
	/**
	 * @Description 获取流程进程表单
	 * @Author longqin
	 * @Time: 2025年05月16日
	 */
	@GetMapping("/getFlowProcessForm")
	public ResponseData<Object> getFlowProcessForm(Integer processId) {
		return feignService.getFlowProcessForm(processId);
	}
	
	/**
	 * @Description 流程处理
	 * @Author longqin
	 * @Time: 2025年05月16日
	 */
	@PostMapping("/dealWork")
	public ResponseData<Object> dealWork(@RequestBody Map<String,Object> params) {
		return feignService.dealWork(params);
	}
	
	/**
	 * @Description 获取流程清单
	 * @Author longqin
	 * @Time: 2025年05月23日
	 */
	@GetMapping("/getFlowList")
	public List<WfFlow> getFlowList() {
		return workService.getFlowList();
	}
	
	/**
	 * @Description 获取流程开始节点表单
	 * @Author longqin
	 * @Time: 2025年05月23日
	 */
	@GetMapping("/getFlowBeginNodeForm")
	public ResponseData<Object> getFlowBeginNodeForm(Integer flowId) {
		return feignService.getFlowBeginNodeForm(flowId);
	}
}
